package com.cashbox.gui.componentes;

import java.awt.Color;
import java.awt.Font;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.Icon;

/**
 *
 * @author Gustavo Enrique Ruiz Cisneros
 */
public class CashBoxLabel extends javax.swing.JLabel {

    private String fuente = "Calibri";
    private int tamFuente = 22;
    private Color colorFuente = new Color(0, 153, 255);
    private Color colorFuente2 = new Color(240, 240, 240);
    private Boolean isForegroundChangeable = Boolean.FALSE;
    
    private labelMouseListener listener = new labelMouseListener();
    

    public String getFuente() {
        return fuente;
    }

    public void setFuente(String fuente) {
        this.fuente = fuente;
    }

    public int getTamFuente() {
        return tamFuente;
    }

    public void setTamFuente(int tamFuente) {
        this.tamFuente = tamFuente;
        init();
    }

    public Color getColorFuente() {
        return colorFuente;
    }

    public void setColorFuente(Color colorFuente) {
        this.colorFuente = colorFuente;
    }

    public Color getColorFuente2() {
        return colorFuente2;
    }

    public void setColorFuente2(Color colorFuente2) {
        this.colorFuente2 = colorFuente2;
    }

    public Boolean getIsForegroundChangeable() {
        return isForegroundChangeable;
    }

    public void setIsForegroundChangeable(Boolean isForegroundChangeable) {
        this.isForegroundChangeable = isForegroundChangeable;
    }

    public CashBoxLabel() {
        init();

    }
    public CashBoxLabel(int tamFuente){
        this.tamFuente = tamFuente;
    }

    private void init() {
        addMouseListener(listener);
        setForeground(getColorFuente());
        setFont(new Font(getFuente(), 0, getTamFuente()));
    }

    public class labelMouseListener extends MouseAdapter {

        @Override
        public void mouseEntered(MouseEvent e) {
            if (getIsForegroundChangeable()) {
                setForeground(getColorFuente2());
            }

        }

        @Override
        public void mouseExited(MouseEvent e) {
            if (getIsForegroundChangeable()) {
                setForeground(getColorFuente());
            }

        }
        
    
        
    }

}
